package hu.dobrosi.dinkycam.j2me.forms;

import hu.dobrosi.dinkycam.j2me.DinkycamApp;
import hu.dobrosi.dinkycam.j2me.Labels;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;

public class DinkycamForm extends Form implements CommandListener {
	protected Command cmdExit;
	protected DinkycamApp app;

	public DinkycamForm(DinkycamApp app, String title) {
		super(title);
		this.app = app;
		buildGUI();
	}

	public String getId() {
		return this.getClass().getName();
	}

	public void buildGUI() {
		addCommand(cmdExit = new Command(Labels.EXIT.toString(), Command.EXIT, 300));
		setCommandListener(this);
	}

	public void commandAction(Command c, Displayable s) {
		if (c == cmdExit) {
			app.exit();
		}
	}
}
